package jp.gr.java_conf.yuzu_project.common;

import jp.gr.java_conf.yuzu_project.R;
import android.app.Activity;
import android.view.Display;
import android.view.Gravity;
import android.view.Menu;
import android.view.WindowManager;
import android.widget.LinearLayout;

public class ComonActivity extends Activity {

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		return super.onCreateOptionsMenu(menu);
	}
	
	/**
	 * テキストビューリサイズ.
	 */
	public void reSizeTextView() {
		int[] displayWidth = getDisplaySize();
		LinearLayout lBottom = (LinearLayout) findViewById(R.id.play_bottom);
		lBottom.setLayoutParams(new LinearLayout.LayoutParams(
				displayWidth[0] / 3, displayWidth[1] - 50, Gravity.CENTER));
	}

	/**
	 * 画面サイズを取得して返す.
	 * 
	 * @return WidthHeight 
	 *         画面サイズ（Widht, Height）の順で返す
	 */
	public int[] getDisplaySize() {
		int[] WidthHeight = new int[2];
		
		WindowManager wm = (WindowManager)getSystemService(WINDOW_SERVICE);
		Display disp = wm.getDefaultDisplay();
		
		WidthHeight[0] = disp.getWidth();
		WidthHeight[1] = disp.getHeight();
		
		return WidthHeight;
	}
}
